package com.tvunetworks.center.user.service.impl;

import com.tvunetworks.center.common.util.JsonUtil;
import com.tvunetworks.center.user.model.User;
import com.tvunetworks.center.user.model.UserDeleteRecord;
import com.tvunetworks.center.user.service.UserDeleteRecordService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @program: tvucc-aggregator
 * @description: UserDeleteRecordServiceImpl
 * @author lebronchen
 * @create: 2021-02-23 14:27
 **/
@Service
@Slf4j
public class UserDeleteRecordServiceImpl extends BaseService<UserDeleteRecord> implements UserDeleteRecordService {

    @Override
    public void addRecord(User user) {
        if (user == null) {
            return;
        }
        UserDeleteRecord userDeleteRecord = JsonUtil.convertValue(user, UserDeleteRecord.class)
                .setUserId(user.getId());
        userDeleteRecord.setId(null);
        super.insert(userDeleteRecord);
    }
}
